home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_riv_candletemple.cog < prev    next >
Text File  |  1999-11-15  |  9KB  |  358 lines

  1. # Jones 3D Cog Script
  2. #
  3. # RIV_CandleTemple.cog
  4. #
  5. # "Scheiß das Fenster!"     
  6. #  [TRM]
  7. #
  8. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  9. # ========================================================================================
  10.  
  11. symbols
  12.     
  13.     message     startup
  14.     message     entered
  15.     message     exited
  16.     message     activated
  17.     message     damaged
  18.     
  19.     thing       player        local
  20.     thing       pushed      local
  21.     thing       pulled      local
  22.     thing        aim_Targ    #mask=0x8
  23.     thing       lever_Pos
  24.     thing       offsetCam
  25.     thing       doorCam
  26.     thing       targ_Door
  27.     thing       door
  28.     thing       indy
  29.     
  30.     surface     surf_Glass  mask=0x8
  31.     surface     surf_Inside
  32.     surface     surf_Block
  33.     surface     surf_Spot
  34.     
  35.     material    mat_Broken=riv_4window_2.mat        local
  36.     
  37.     template    tpl_Shards=stained_class            local   # stained glass particles
  38.     template    tplLevPull=pullever                 local
  39.     template    tplLevPush=pushlever                local
  40.     
  41.     keyframe    leverPull=gen_lever_pull.key        local
  42.     keyframe    leverPush=gen_lever_push.key        local
  43.     
  44.     keyframe    indyPull=in_pull_lever.key          local
  45.     keyframe    indyPush=in_push_lever.key          local
  46.     
  47.     # ** sound fx **
  48.     sound       snd_Lever=gen_lever_pull.wav            local
  49.     sound        snd_Shatter=shs_glassbreak.wav          local
  50.     sound       snd_DoorOpen=riv_door_wood_slide.wav    local
  51.     sound       snd_DoorStop=riv_door_wood_stop.wav     local
  52.     
  53.     # ** voice lines **
  54.     sound       say_Candle=Rv04j01.wav                  local   # is that a candle in there?
  55.     
  56.     # ** just won't open lines **
  57.     sound        in_DoorLocked0=Inxj096.wav                local # I can't open it-->insayline[25]
  58.     sound        in_DoorLocked1=Inxj097.wav              local # For some reason...won't open.
  59.     sound        in_DoorLocked2=Inxj098.wav                local # It won't budge.
  60.     sound        in_DoorLocked3=Inxj099.wav              local # Something is holding this door closed.
  61.     sound        in_DoorLocked4=Inxj102.wav                local # must be way...don't know how.
  62.     
  63.     cog         hintCog
  64.     
  65.     # ** subroutines **
  66.     flex        pullLever       local
  67.     flex        pushLever       local
  68.     flex        speak           local
  69.     
  70.     # ** ints **
  71.     int         onSpot=0        local
  72.     int         broken=0        local
  73.     int         lever_Ready=1   local
  74.     int         firstTime=1     local
  75.     int         open=0          local
  76.     int         playing=0       local
  77.     int         newComment      local
  78.     int         oldComment      local
  79.     
  80. end
  81.  
  82. # ========================================================================================
  83.  
  84. code
  85.  
  86. startup:
  87.     
  88.     player = GetLocalPlayerThing();
  89.     
  90.     pushed = CreateThing(tplLevPull, lever_Pos);
  91.     CaptureThing(pushed);
  92.     
  93.     SetThingLight(door, '0.5 0.5 0.5', 0.001, 1.0);
  94.     
  95.     return;
  96.     
  97. # ========================================================================================
  98.  
  99. entered:
  100.  
  101.     if(GetSenderRef() == surf_Spot)
  102.     {
  103.         Print("on Spot");
  104.         onSpot = 1;
  105.     }
  106.  
  107.     return;
  108.     
  109. # ========================================================================================
  110.  
  111. exited:
  112.  
  113.     if((GetSenderRef() == surf_Spot) && (GetSourceRef() == player))
  114.     {
  115.         Print("off spot");
  116.         onSpot = 0;
  117.     }
  118.     
  119.     return;
  120.     
  121. # ========================================================================================
  122.  
  123. activated:
  124.  
  125.     Print("activated");
  126.     
  127.     if((GetSenderRef() == pushed) && (lever_Ready == 1) && (onSpot == 1))
  128.     {
  129.         Print("pushed");
  130.         lever_Ready = 0;
  131.         Call pullLever;
  132.     }
  133.     
  134.     else if((GetSenderRef() == pulled) && (lever_Ready == 1) && (onSpot == 1))
  135.     {
  136.         Print("pulled");
  137.         lever_Ready = 0;
  138.         Call pushLever;
  139.     }
  140.     
  141.     else if((GetSenderRef() == door) && (open == 0) && (playing == 0))
  142.     {
  143.         playing = 1;
  144.         Call speak;
  145.     }
  146.  
  147.     return;
  148.  
  149. # ========================================================================================
  150.  
  151. damaged:
  152.     
  153.     if(broken == 0)
  154.     {
  155.         broken = 1;
  156.         # Make adjoin move
  157.         SetAdjoinFlags(surf_Glass, 2);
  158.         
  159.         # player can move thru
  160.         ClearAdjoinFlags(surf_Block, 0x10);
  161.         
  162.         # play sfx and create debris
  163.         PlaySoundLocal(snd_Shatter, 1.0, 0, 0, 0);
  164.         CreateThing(tpl_Shards, aim_Targ);
  165.         
  166.         # swap texture
  167.         SetSurfaceMat(surf_Glass, mat_Broken);
  168.         SetSurfaceMat(surf_Inside, mat_Broken);
  169.         
  170.         Sleep(0.01);
  171.         DestroyThing(aim_Targ);
  172.     }
  173.     
  174.     return;
  175.  
  176. # ========================================================================================
  177.  
  178. pullLever:
  179.  
  180.     SendMessage(hintCog, user0);
  181.     
  182.     # do cutscene stuff
  183.     MakeMeStop();
  184.     StartCutscene(2);
  185.     
  186.     DeselectWeaponWait(player);
  187.     
  188.     # outfit Indy actor
  189.     CopyPlayerHolsters(player, indy);
  190.     
  191.     # switch to offsetCam
  192.     SetCameraFocus(2, offsetCam);
  193.     SetCameraSecondaryFocus(2, indy);
  194.     SetCurrentCamera(2);
  195.     SetCameraFOV(90, 0, 0.0);
  196.     
  197.     # show actor hide player
  198.     SetThingFlags(player, 0x80000);
  199.     ClearThingFlags(indy, 0x80000);
  200.     
  201.     # pull the lever
  202.     PlayKey(pushed, leverPull, 4, 0x14, 0);
  203.     PlayKey(indy, indyPull, 4, 0x12, 0);
  204.     Sleep(0.8); #0.75
  205.     PlaySoundLocal(snd_Lever, 1.0, 0.0, 0x0, 1);
  206.  
  207.     # switch to doorCam
  208.     SetCameraFocus(2, doorCam);
  209.     SetCameraSecondaryFocus(2, targ_Door);
  210.     SetCurrentCamera(2);
  211.     SetCameraFOV(90, 0, 0.0);
  212.     
  213.     Sleep(0.5);
  214.     
  215.     # open the door
  216.     PlaySoundLocal(snd_DoorOpen, 1.0, 0, 0, 0);
  217.     MoveToFrame(door, 1, 2.0);
  218.     WaitForStop(door);
  219.     
  220.     # Destroy old lever and create a new one
  221.     DestroyThing(pushed);
  222.     pulled = CreateThing(tplLevPush, lever_Pos);
  223.     CaptureThing(pulled);
  224.     
  225.     # stop any unfinished animations
  226.     ResetThing(indy);
  227.     
  228.     Sleep(1.0);
  229.     
  230.     # show player and return controls
  231.     SetThingFlags(indy, 0x80000);
  232.     ClearThingFlags(player, 0x80000);
  233.     ClearActorFlags(player, 0x200000);
  234.     
  235.     # return camera to player
  236.     SetCurrentCamera(1);
  237.     
  238.     EndCutscene();
  239.     
  240.     lever_Ready = 1;
  241.     open = 1;
  242.     
  243.     return;
  244.     
  245. # ========================================================================================
  246.  
  247. pushLever:
  248.  
  249.     # do cutscene stuff
  250.     MakeMeStop();
  251.     StartCutscene(2);
  252.     
  253.     DeselectWeaponWait(player);
  254.     
  255.     # outfit indy actor
  256.     CopyPlayerHolsters(player, indy);
  257.     
  258.     # switch to offsetCam
  259.     SetCameraFocus(2, offsetCam);
  260.     SetCameraSecondaryFocus(2, indy);
  261.     SetCurrentCamera(2);
  262.     SetCameraFOV(90, 0, 0.0);
  263.     
  264.     # show actor hide player
  265.     SetThingFlags(player, 0x80000);
  266.     ClearThingFlags(indy, 0x80000);
  267.     
  268.     # push the lever
  269.     PlayKey(pulled, leverPush, 4, 0x14, 0);
  270.     PlayKey(indy, indyPush, 4, 0x12, 0);
  271.     Sleep(0.9); #0.85
  272.     PlaySoundLocal(snd_Lever, 1.0, 0.0, 0x0, 1);
  273.     
  274.     # switch to doorCam
  275.     SetCameraFocus(2, doorCam);
  276.     SetCameraSecondaryFocus(2, targ_Door);
  277.     SetCurrentCamera(2);
  278.     SetCameraFOV(90, 0, 0.0);
  279.     
  280.     Sleep(0.5);
  281.     
  282.     # close the door
  283.     PlaySoundLocal(snd_DoorOpen, 1.0, 0, 0, 0);
  284.     MoveToFrame(door, 0, 3.0);
  285.     WaitForStop(door);
  286.     PlaySoundLocal(snd_DoorStop, 1.0, 0, 0, 0);
  287.     
  288.     # Destroy old lever and create a new one
  289.     DestroyThing(pulled);
  290.     pushed = CreateThing(tplLevPull, lever_Pos);
  291.     CaptureThing(pushed);
  292.     
  293.     # stop any unfinished animations
  294.     ResetThing(indy);
  295.     
  296.     Sleep(1.0);
  297.     
  298.     # show player and return controls
  299.     SetThingFlags(indy, 0x80000);
  300.     ClearThingFlags(player, 0x80000);
  301.     ClearActorFlags(player, 0x200000);
  302.     
  303.     # return camera to player
  304.     SetCurrentCamera(1);
  305.     
  306.     EndCutscene();
  307.     
  308.     lever_Ready = 1;
  309.     open = 0;
  310.     
  311.     return;
  312.     
  313. # ========================================================================================
  314.  
  315. speak:
  316.  
  317.     # do cutscene stuff
  318.     MakeMeStop();
  319.     StartCutscene(2);
  320.     
  321.     DeselectWeaponWait(player);
  322.     
  323.     PlayMode(player, 60, 0);
  324.     Sleep(0.3);
  325.     
  326.     if(firstTime == 1)
  327.     {
  328.         firstTime = 0;
  329.         PlayVoice(player, say_Candle, 1.0, 1);
  330.     }
  331.     
  332.     else
  333.     {
  334.         while (newComment == oldComment) 
  335.         {
  336.             newComment = RandBetween(0, 4);
  337.         }
  338.         
  339.         oldComment = newComment;
  340.         
  341.         # say success line
  342.         PlayVoice(player, in_DoorLocked0[newComment], 1.0, 1);
  343.     }
  344.     
  345.     # restore controls
  346.     ClearActorFlags(player, 0x200000);
  347.     EndCutscene();
  348.     
  349.     playing = 0;
  350.     
  351.     return;
  352.     
  353. # ========================================================================================
  354.  
  355. end
  356.  
  357.